/**
 * 定义宏swap(t,x,y)，交换t格式的两个数x,y
 */

#include <stdio.h>

#define swap(t, x, y) \
    do { \
        t temp ## x ## y; \
        temp ## x ## y = x; \
        x = y; \
        y = temp ## x ## y; \
    } while (0) 

int main(void) {
    double x = 2.4;
    double y = -3.8;
    printf("x = %g, y = %g\n", x, y);
    swap(double, x, y);
    printf("x = %g, y = %g\n", x, y);

    return 0;
}
